#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

public = "pub"
_private = "pri"

def aop(func):
    def aoper(*args, **kwargs):
        print("aop前置增强")
        res = func(*args, **kwargs)
        print("aop后置增强")
        return res

    return aoper


def aop2(text):
    def decoratro(func):
        def warpper(*args, **kwargs):
            print("aop前置增强2" + text)
            res = func(*args, **kwargs)
            print("aop后置增强2" + text)
            return res

        return warpper
    return decoratro



@aop2('yahaha')
def test():
    args = sys.argv
    if len(args) == 1:
        print('Hello, world!')
    elif len(args) == 2:
        print('Hello, %s!' % args[1])
    else:
        print('Too many arguments!')


if __name__ == '__main__':
    test()
